﻿@model IViewModel
@{
    string description = null;

    if (Model.MasterModel.ItemDescription.IsNotEmpty())
    {
        description = Model.MasterModel.ItemDescription;
    }
    else
    {
        var entityModel = Model as IEntityModel<IPersistentObject, IFilter>;

        if (entityModel.Is() && entityModel.Item.Is())
        {
            description = entityModel.Item.ToDisplay();
        }
    }
}
@*@AddControls(
    // I. a home link, with the Application name
    new Anchor()
    .SetHref(Url.Action(Str.Actions.Default, Str.Controllers.Home))
    .SetTitle("Home (Ctrl + Alt + H)")
    .SetAttribute(Attr.AccessKey, "h")
    .AddControls
    (
        new Literal(Str.Common.ApplicationName, true)
    ),

    // II. current controller (and its default action)
    new Literal(" > ")
)*@
@AddControls(
    new Anchor()
    .SetHref(Url.Action(Str.Actions.Default, Model.MasterModel.ControllerName))
    .SetTitle(GetLocalized(Model.MasterModel.ControllerName))
    .AddControls
    (
        new Literal(Model.MasterModel.ControllerName, true)
    ),

    // III. current action without link (if exists)
    new Literal(Model.MasterModel.ActionDescription.IsNotEmpty() ? " > " : null),
    Model.MasterModel.ActionDescription.IsNotEmpty()
        ? new Anchor("none noPointer")
                .AddControls (  new Literal(Model.MasterModel.ActionDescription, true) )
        : null,

    // IV. A description (if available)
    new Literal(description.IsNotEmpty() ? " > " : null),
    description.IsNotEmpty()
        ? new Anchor("none noPointer")
                .AddControls (new Literal(description) )
        : null
)
